import Vue from 'vue'

import Cookies from 'js-cookie'
import VDistpicker from 'v-distpicker'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import Element from 'element-ui'
import './styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'
// import 'lib-flexible'


import './icons' // icon
import '@/permission' // permission control
import './utils/error-log' // error log
import './utils/flexible.js'

import * as filters from './filters' // global filters

import request from '@/utils/request'
import auth from '@/utils/auth'
import qs from 'qs'

import permission from '@/directive/permission/index.js';
import Echarts from 'echarts'
import 'echarts-gl'
import VueAMap from 'vue-amap'
import VueParticles from 'vue-particles'

// import { mockXHR } from 'mock'
// if (process.env.NODE_ENV === 'production') {
//   mockXHR()
// }

// import { mockXHR } from '../mock'
// if (process.env.NODE_ENV === 'production') {
//   mockXHR()
// }

Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // set element-ui default size
})

Vue.use(permission);
Vue.use(VueAMap);
Vue.use(VueParticles)

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

//  高德地图
VueAMap.initAMapApiLoader({
  key: '24e73473dd841353fbe1cc26535ff473',
  plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.Geocoder',"AMap.Autocomplete"],
  uiVersion: '1.1', // ui库版本，不配置不加载,
  v: '1.4.15'
})

Vue.prototype.$axios = request
Vue.prototype.$qs = qs
Vue.prototype.$echarts = Echarts
Vue.prototype.$auth = auth
Vue.prototype.bus = new Vue();

window.uploadUrl = 'http://172.16.1.2:8081/upload/upload-batch'
window.fileUrlPrefix = 'http://htyy-file.yaocaicai.cn/distribution/'

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
